package cn.yuanqiao.archive.Identify.domain.vo;

import cn.yuanqiao.archive.Identify.domain.DestroyCar;
import cn.yuanqiao.common.utils.DateUtils;

import java.lang.reflect.Field;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class DestroyCarVo extends DestroyCar {
    private String title;

    private String dh;

    private String nd;

    private String bgqx;

    private String fileCount;

    private String ys;

    /**
     * 初审处置方式
     * 1 = 续存 2 = 销毁
     */
    private String csczfs;

    /**
     * 初审处置意见
     */
    private String csczyj;

    /**
     * 复审处置方式
     * 1 = 续存 2 = 销毁
     */
    private String fsczfs;

    /**
     * 复审处置意见
     */
    private String fsczyj;

    /**
     * 审定处置方式
     * 1 = 续存 2 = 销毁
     */
    private String sdczfs;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDh() {
        return dh;
    }

    public void setDh(String dh) {
        this.dh = dh;
    }

    public String getNd() {
        return nd;
    }

    public void setNd(String nd) {
        this.nd = nd;
    }

    public String getBgqx() {
        return bgqx;
    }

    public void setBgqx(String bgqx) {
        this.bgqx = bgqx;
    }

    public String getFileCount() {
        return fileCount;
    }

    public void setFileCount(String fileCount) {
        this.fileCount = fileCount;
    }

    public String getYs() {
        return ys;
    }

    public void setYs(String ys) {
        this.ys = ys;
    }

    public String getCsczfs() {
        return csczfs;
    }

    public void setCsczfs(String csczfs) {
        this.csczfs = csczfs;
    }

    public String getCsczyj() {
        return csczyj;
    }

    public void setCsczyj(String csczyj) {
        this.csczyj = csczyj;
    }

    public String getFsczfs() {
        return fsczfs;
    }

    public void setFsczfs(String fsczfs) {
        this.fsczfs = fsczfs;
    }

    public String getFsczyj() {
        return fsczyj;
    }

    public void setFsczyj(String fsczyj) {
        this.fsczyj = fsczyj;
    }

    public String getSdczfs() {
        return sdczfs;
    }

    public void setSdczfs(String sdczfs) {
        this.sdczfs = sdczfs;
    }

    public Map<String, Object> toProcessMap() {
        Map<String, Object> map = new HashMap<>();

        // 使用反射获取实体类的字段信息
        Class<?> clazz = this.getClass();
        Field[] fields = clazz.getDeclaredFields();

        try {
            // 遍历所有字段，获取字段名和字段值，并存储到 Map 中
            for (Field field : fields) {
                if (field.getType().isAssignableFrom(Date.class)){
                    field.setAccessible(true); // 设置字段可访问，即使是私有字段也可以获取值
                    String fieldName = field.getName();
                    Object fieldValue = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, (Date) field.get(this)); // 获取字段的值
                    map.put(fieldName, fieldValue);
                    continue;
                }
                field.setAccessible(true); // 设置字段可访问，即使是私有字段也可以获取值
                String fieldName = field.getName();
                Object fieldValue = field.get(this); // 获取字段的值
                map.put(fieldName, fieldValue);
            }
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        return map;
    }
}
